package com.z6school.manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.z6school.manage.po.Student;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface StudentMapper<Z6Student> extends BaseMapper<Student> {

    List<Student> findObjects(@Param("studentName") String studentName,@Param("startIndex") Integer startIndex,@Param("pageSize") Integer pageSize);

    int getCount(@Param("studentName") String studentName);

/************************************************************************************************************************/
    /**
     * 查询成绩时用
     * @param classId
     * @return
     */
    //根据班级id查询所有该班级学生 id
    @Select("select studentId from student where classId=#{classId}")
    List<Integer> findStudentIds(Integer classId);
    //根据学生名查询学生信息
    @Select("select studentName from student where studentId=#{studentId}")
    String findNameById(Integer id);

    //根据学生 id 查询所在班级 ID
    @Select("select classId from student where studentId=#{studentId}")
    Integer findClassIdByStudentId(Integer studentId);
}
